/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jpa.entities;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Usuario
 */
@Entity
@Table(name = "gasto", catalog = "Sig", schema = "")
@NamedQueries({
    @NamedQuery(name = "Gasto.findAll", query = "SELECT g FROM Gasto g"),
    @NamedQuery(name = "Gasto.findByIdgasto", query = "SELECT g FROM Gasto g WHERE g.idgasto = :idgasto"),
    @NamedQuery(name = "Gasto.findByFecha", query = "SELECT g FROM Gasto g WHERE g.fecha = :fecha"),
    @NamedQuery(name = "Gasto.findByConcepto", query = "SELECT g FROM Gasto g WHERE g.concepto = :concepto"),
    @NamedQuery(name = "Gasto.findByMoneda", query = "SELECT g FROM Gasto g WHERE g.moneda = :moneda"),
    @NamedQuery(name = "Gasto.findByMonto", query = "SELECT g FROM Gasto g WHERE g.monto = :monto"),
    @NamedQuery(name = "Gasto.findByNumFac", query = "SELECT g FROM Gasto g WHERE g.numFac = :numFac"),
    @NamedQuery(name = "Gasto.findByDetalle", query = "SELECT g FROM Gasto g WHERE g.detalle = :detalle")})
public class Gasto implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idgasto", nullable = false)
    private Integer idgasto;
    @Basic(optional = false)
    @Column(name = "fecha", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date fecha;
    @Basic(optional = false)
    @Column(name = "concepto", nullable = false, length = 45)
    private String concepto;
    @Basic(optional = false)
    @Column(name = "moneda", nullable = false)
    private boolean moneda;
    @Basic(optional = false)
    @Column(name = "monto", nullable = false)
    private float monto;
    @Column(name = "numFac", length = 45)
    private String numFac;
    @Column(name = "detalle", length = 45)
    private String detalle;
    @OneToMany(mappedBy = "gasto")
    private List<Contabilidad> contabilidadList;
    @JoinColumn(name = "usuario", referencedColumnName = "idUsuario", nullable = false)
    @ManyToOne(optional = false)
    private Usuario usuario;

    public Gasto() {
    }

    public Gasto(Integer idgasto) {
        this.idgasto = idgasto;
    }

    public Gasto(Integer idgasto, Date fecha, String concepto, boolean moneda, float monto) {
        this.idgasto = idgasto;
        this.fecha = fecha;
        this.concepto = concepto;
        this.moneda = moneda;
        this.monto = monto;
    }

    public Integer getIdgasto() {
        return idgasto;
    }

    public void setIdgasto(Integer idgasto) {
        this.idgasto = idgasto;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public String getConcepto() {
        return concepto;
    }

    public void setConcepto(String concepto) {
        this.concepto = concepto;
    }

    public boolean getMoneda() {
        return moneda;
    }

    public void setMoneda(boolean moneda) {
        this.moneda = moneda;
    }

    public float getMonto() {
        return monto;
    }

    public void setMonto(float monto) {
        this.monto = monto;
    }

    public String getNumFac() {
        return numFac;
    }

    public void setNumFac(String numFac) {
        this.numFac = numFac;
    }

    public String getDetalle() {
        return detalle;
    }

    public void setDetalle(String detalle) {
        this.detalle = detalle;
    }

    public List<Contabilidad> getContabilidadList() {
        return contabilidadList;
    }

    public void setContabilidadList(List<Contabilidad> contabilidadList) {
        this.contabilidadList = contabilidadList;
    }

    public Usuario getUsuario() {
        return usuario;
    }

    public void setUsuario(Usuario usuario) {
        this.usuario = usuario;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idgasto != null ? idgasto.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Gasto)) {
            return false;
        }
        Gasto other = (Gasto) object;
        if ((this.idgasto == null && other.idgasto != null) || (this.idgasto != null && !this.idgasto.equals(other.idgasto))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Gasto[idgasto=" + idgasto + "]";
    }

}
